// axios 请求
import axios from 'axios'
import instance from './header.ts'

const request = class {
    constructor(url, arg) {
        this.url = url
        this.arg = arg
    }

    // post 请求
    modePost() {
        return new Promise((resolve, reject) => {
            instance.post((this.url), this.arg).then(res => {
                resolve(res)
            }).catch(err => {
                reject(err)
            })
        })
    }

    // get 请求
    modeGet() {
        return new Promise((resolve, reject) => {
            instance.get((this.url))
            .then(res => {
                resolve(res)
            })
            .catch(err => {
                reject(err)
            })
        })
    }
}